#include<bits/stdc++.h>

using namespace std;

/**
 * 字符串比较函数实现
 * @param s
 * @return
 */
int Strcmp(char a[], char b[]) {
    int i = 0, j = 0;
    while (a[i] || b[j]) {
        if (a[i] - b[j]) {
            return a[i] - b[j];
        }
        i++;
        j++;
    }
    return a[i] - b[j];

}

int main() {
    char a[100] = "apple";
    char b[100] = "banana";
    cout << Strcmp(a, b) << endl; //negative
    cout << Strcmp(b, a) << endl; //positive
    cout << Strcmp(a, a) << endl; //equal
    return 0;
}
